﻿@using NorthWind.Models
@model List<Order>
@{
    ViewBag.Title = "AllOrdersSortedByDate";
}

@Html.ActionLink("Ajouter une commande", "Create", "Order")
@Html.ActionLink("Toutes les commandes", "AllOrdersSortedByDate", "Order")
@Html.ActionLink("Prochaines commandes", "NextOrders", "Order")
@Html.ActionLink("Vue par client", "ViewByClient", "Order")
@Html.ActionLink("Vue par employee", "ViewByEmployee", "Order")
@Html.ActionLink("Calendrier", "Index", "Calendar")
<br />

<h2>Liste des Commandes triée par date</h2>

@using (Html.BeginForm("ExportToExcel", "Order"))
{
    <input type="submit" value="Export" />
    <table style="border: none; width: 100%">

        <tr>
            <th></th>
            <th>Numéro</th>
            <th>Client</th>
            <th>Employé</th>
            <th>Expéditeur</th>
            <th>Date de Commande</th>
        </tr>


        @foreach (Order order in Model)
        {
            <tr>
                <td><input type="checkbox" name="checkBox"  value="@order.OrderID"/></td>
                <td class="center">@order.OrderID</td>
                <td>@Html.ActionLink(@order.Customer.CompanyName.ToString(), "Details", "Customer", new { id = order.CustomerID }, null)</td>
                <td>@Html.ActionLink(@order.Employee.FirstName + " " + @order.Employee.LastName, "Details", "Employee", new { id = order.EmployeeID }, null)</td>
                <td>@Html.ActionLink(@order.Shipper.CompanyName, "Details", "Shipper", new { id = order.ShipVia }, null)</td>
                <td class="center">@order.OrderDate.Value.ToShortDateString()</td>
                <td>@Html.ActionLink("Details", "Details", "Order", new { id = order.OrderID }, null)</td>
                <td>@Html.ActionImage("Edit", new {id = order.OrderID}, "~/Content/Images/edit.png", "Modifier")</td>
                <td>@Html.ActionImage("Delete", new {id = order.OrderID}, "~/Content/Images/delete.png", "Supprimer")</td>
            </tr>  
        }
    </table>
}
<br />
@if (ViewBag.HasPreviousPage)
{
    @Html.ActionImage("Index", new { page = (ViewBag.PageIndex - 1) }, "~/Content/Images/previous.png", "Précédent")
}

@if (ViewBag.HasNextPage)
{
    @Html.ActionImage("Index", new { page = (ViewBag.PageIndex + 1) }, "~/Content/Images/next.png", "Suivant")
} 